package com.agg.persist.provider;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.jdbc.SQL;

public class DeleteTemplateProvider {

    private final static String space=" ";

    public String deleteTemplate(@Param("table")String table,
                                 String columnName,@Param("val")Object val){
        SQL sql = new SQL();
        sql.DELETE_FROM(table);
        sql.WHERE(columnName+"=#{val}");
        return sql.toString();
    }

    public String deleteLogicTemplate(@Param("table")String table,
                                      @Param("delVal")Object delVal,
                                      @Param("logicDeleteKey")Object logicDeleteKey,
                                 String columnName,@Param("val")Object val){
        SQL sql = new SQL();
        sql.UPDATE(table);
        sql.SET(logicDeleteKey+"="+delVal);
        sql.WHERE(columnName+"=#{val}");
        return sql.toString();
    }


}
